<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport"
	content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />


<meta name="MobileOptimized" content="320" />
<title>请假审批单</title>
<link
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
	rel="stylesheet">
<script
	src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
</script>
<link rel="stylesheet" href="css/common.css" type="text/css"
	charset="utf-8" />
<style type="text/css">
li {
	padding: 0.8em;
	border-bottom: 1px solid #eaeaea;
}

li:active {
	background: #f4f4f4;
}

.iabout {
	background: no-repeat center center
		url();
	background-size: 50px 44px;
}

.item {
	display: block;
	background: no-repeat right center
		url();
	background-size: 12px 22px;
	-ms-touch-action: auto;
}

.chs {
	font-size: 0.8em;
	color: #838383;
}
</style>
</head>
<body>
	
	<script type="text/javascript">
	</script>
	<div id="content" class="content">
		<ul id="plist"
			style="list-style: none; margin: 0; padding: 0; text-align: left;">
			<li id="plus/audio.html"><span class="item">请假人员 <input
					type="hidden" id="userid" value="${id}">
					<div class="chs" style="float: right; margin-right: 15px;">
						<span style="font-size: 15px;">${username}</span>
					</div>
			</span></li>
			<li id="plus/accelerometer.html"><span class="item">请假类型
					<div class="chs" style="float: right; margin-right: 15px;">
						<select id="qingJiaTypeId" class="selectpicker">
							<option value="1083">事假</option>
							<option value="1085">病假</option>
							<option value="1084">年假</option>
						</select>
					</div>
			</span></li>
			<li id="plus/audio.html"><span class="item">开始时间
					<div class="chs" style="float: right; margin-right: 15px;">
						<input type="datetime-local" id="startTime" />
					</div>
			</span></li>
			<li id="plus/barcode.html"><span class="item">结束时间
					<div class="chs" style="float: right; margin-right: 15px;">
						<input type="datetime-local" id="endTime" />
					</div>
			</span></li>
			<li id="plus/camera.html" onclick="clicked(this.id)"><span
				class="item">请假时长
					<div style="float: right; margin-right: 15px;" class="chs">
						<input type="text" style="width: 150px;" id="days" />&nbsp;&nbsp;天
					</div>
			</span></li>
			<li id="plus/camera.html" onclick="clicked(this.id)"><span
				class="item">上传照片
					<div style="float: right; margin-right: 15px;" class="chs">
						<input type="file" accept="image/*" style="width: 150px;"
							id="file"><input type="hidden" value="" id="picture"
							name="picture" />
					</div>
			</span></li>
			<li id="plus/camera.html" onclick="clicked(this.id)"><span
				class="item" style="height: 120px;">备注
					<div style="float: right; margin-right: 15px;" class="chs">
						<textarea style="width: 260px" rows="6" cols="20" id="remark"></textarea>
					</div>
			</span></li>


			<div style="text-align: center; margin-top: 30px;">
				<button type="button" class="btn btn-success" style="width: 70%;"
					onClick="commit()">提交</button>
			</div>
		</ul>
	</div>
</body>
<script type="text/javascript" src="js/immersed.js"></script>
<script type="text/javascript" src="js/shortcut.js"></script>
<script type="text/javascript">
	function startTime() {
		$("#beginTime").click();
	}

	function commit() {

		var reg = /^\d+(\.\d+)?$/;
		if (!reg.test($("#days").val())) {
			alert("天数格式输入不正确！");
			return false;
		}
		var formData = new FormData();
		var uploadFile = $('#file').get(0).files[0];
		formData.append("file", uploadFile || 0);
		formData.append("id", 0);
		formData.append("startTime", $("#startTime").val());
		formData.append("endTime", $("#endTime").val());
		formData.append("remark", $("#remark").val());
		formData.append("days", $("#days").val());
		formData.append("picture", $("#picture").val());
		formData.append("qingJiaTypeId", $('#qingJiaTypeId option:selected')
				.attr('value'));
		formData.append("personId", $("#userid").val());
		$.ajax({
			url : '../phone/weixinAdd',
			type : 'POST',
			dataType : "json",
			data : formData,
			async : false,
			cache : false,
			contentType : false, //不设置内容类型  
			processData : false, //不处理数据  
			success : function(data) {
				if (data.status == 200) {
					alert(data.message);
				} else {
					alert(data.message);
				}
			}
		});
	}
</script>

</html>